package com.manger.listener;

import com.manger.chrome.DriverManger;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

public class JFrameWindowListener implements WindowListener {

    @Override
    public void windowActivated(WindowEvent e) {
    }

    @Override
    public void windowClosed(WindowEvent e) {
    }

    @Override
    public void windowDeactivated(WindowEvent e) {
    }

    @Override
    public void windowDeiconified(WindowEvent e) {
    }

    @Override
    public void windowClosing(WindowEvent e) {
        //关闭浏览器
        if(DriverManger.driver == null){
            return;
        }
        System.out.println("=================JFrameWindow===============");
        DriverManger.driver.quit();
    }

    @Override
    public void windowIconified(WindowEvent e) {
    }

    @Override
    public void windowOpened(WindowEvent e) {
    }
}

